<?php
    $this->breadcrumbs = array(
        t('Customer Loan Setting'),
    );

    /* $this->menu = array(
      array('label' => t('Create Customer Loan Setting'), 'url' => array('create')),
      array('label' => t('Manage Customer Loan Setting'), 'url' => array('admin')),
      ); */
?>

<h1><?php echo t('Customer Loan Setting'); ?></h1>

<?php
    /* $this->widget('bootstrap.widgets.TbListView', array(
      'dataProvider' => $dataProvider,
      'itemView' => '_view',
      )); */
?>

<?php
    $this->widget('bootstrap.widgets.TbButton', array(
        //'buttonType' => 'ajaxLink',
        'type' => 'primary',
        'label' => t('New Loan'),
        'url' => $this->createURL('customerloansetting/create'),
        'icon' => 'icon-white icon-plus',
    ));
?>

<?php
    $this->widget('bootstrap.widgets.TbGridView', array(
        'type' => 'striped bordered condensed',
        'dataProvider' => $dataProvider,
        'template' => '{summary}{items}{pager}',
        'enablePagination' => true,
        'columns' => array(
            array('name' => 'id', 'header' => '#'),
            array('name' => 'customer.firstname', 'header' => t('First Name')),
            array('name' => 'customer.lastname', 'header' => t('Last Name')),
            array('name' => 'customer_code', 'header' => t('Customer Code')),
            array('name' => 'loan_code', 'header' => t('Loan Code')),
            array('name' => 'loan_amount', 'header' => t('Loan Amount')),
            array('name' => 'period', 'header' => t('Period')),
            array('name' => 'period_type', 'header' => t('Period Type'), 'value' => 't($data->period_type)'),
            array('name' => 'paying_amount', 'header' => t('Paying Amount')),
            array('name' => 'status', 'header' => t('Status'), 'value' => 't($data->status)'),
            array('name' => 'active', 'header' => t('Active'), 'value' => 't($data->active)'),
            array('name' => 'createtime', 'header' => t('Created Time'), 'value' => 'date("Y-m-d", strtotime($data->createtime))'),
            //array('name' => 'status', 'header' => 'Language'),
            array(
                'class' => 'bootstrap.widgets.TbButtonColumn',
                'htmlOptions' => array('style' => 'width: 50px'),
                'template' => '{loanPayment}{view}{update}{delete}',
                'buttons' => array(
                    'loanPayment' => array(
                        'label' => t('Loan Payment'),
                        'url' => 'Yii::app()->createUrl(\'customerloanpayment/payment\', array(\'id\'=>$data["id"]))', // a PHP expression for generating the URL of the button
                        'imageUrl' => Yii::app()->request->baseUrl . '/images/payment.png', // image URL of the button. If not set or false, a text link is used
                        'options' => array(
                        //'onclick' => 'return false;',
                        ),
                        'visible' => '$data->active',
                    ),
                ),
            ),
        ),
    ));
?>
